﻿using System;
using System.Collections.Generic;
using MicroService.Interface;
using MicroService.Model;

namespace MicroService.Service
{
    public class UserService : IUserService
    {
        #region DataInit

        private List<User> _UserList = new List<User>()
        {
            new User()
            {
                Id = 1,
                Account = "Admin",
                Email = "123@qq.com",
                Name = "kong",
                Password = "123",
                LoginTime = DateTime.Now,
                Role = "Admin"
            },
            new User()
            {
                Id = 2,
                Account = "apple",
                Email = "12233@qq.com",
                Name = "apple",
                Password = "123",
                LoginTime = DateTime.Now,
                Role = "Admin"
            },
            new User()
            {
                Id = 3,
                Account = "orange",
                Email = "12233@qq.com",
                Name = "orange",
                Password = "123",
                LoginTime = DateTime.Now,
                Role = "Admin"
            }
        };
        #endregion

        public User FindUser(int id)
        {
            return _UserList.Find(c => c.Id == id);
        }

        public IEnumerable<User> UserAll()
        {
            return _UserList;
        }
    }
}
